home *** CD-ROM | disk | FTP | other *** search
- /************************************/
- /* File: RemoveControl XFCN.c */
- /* */
- /* Parameters: */
- /* params[0] == control handle */
- /* */
- /* If no more control in the list */
- /* go ahead and dispose the patch */
- /* */
- /* returns NIL to indicate the */
- /* control was removed */
- /* -------------------------------- */
- /* © 1989 Donald Koscheka */
- /* All Rights Reserved */
- /************************************/
-
- #define UsingHypercard
-
- #include <MacTypes.h>
- #include <OSUtil.h>
- #include <ControlMgr.h>
- #include <HyperXCmd.h>
- #include <HyperUtils.h>
- #include "Control XFCN.h"
-
- #define ScrollSize 15
- #define CONTROL_TYPES 6000
-
- #include "miniParser.c"
-
- pascal void main( paramPtr )
- XCmdBlockPtr paramPtr;
- {
- ControlHandle theControl = NIL;
- WindowPtr theWindow = FrontWindow();
- WindowPeek wPeek = (WindowPeek)theWindow;
- wdGlobalsHand windH;
-
- if( paramPtr->params[0] ){
- theControl = (ControlHandle)paramtoNum( paramPtr, 0 );
-
- if( validHandle( theControl ) )
- DisposeControl( theControl );
-
- }/*** if paramPtr[0] ***/
-
- /*** if no more control in the list ***/
- /*** remove the patch since it isn't ***/
- /*** needed any longer ***/
- if( !wPeek->controlList ){
- if( windH = (wdGlobalsHand)GetSystemResource( CONTROL_INFO, CONTROL_PATCH ) ){
- wdGlobalsPtr wp = *windH;
- Handle patch = (Handle)(wp->evtProc);
-
- /*** unload the patch ***/
- NSetTrapAddress( wp->oldTrap, EVENT_TRAP, ToolTrap);
- TrashHandle( patch );
- RemoveSystemResource( (Handle)windH );
- }
- }
-
- paramPtr->returnValue = NIL;
- }
-
-